<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <link rel="icon" type="image/x-icon" th:href="@{/img/favicon.ico}">

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>考试结果</title>

    <script th:src="@{/js/jquery-3.3.1.js}"></script>
    <script th:src="@{/js/popper.js}"></script>
    <script th:src="@{/js/toolkit.js}"></script>
    <script th:src="@{/js/component.js}"></script>
    <script th:src="@{/js/jquery.countdown.js}"></script>

    <link th:href="@{/css/antd.css}" rel="stylesheet">
    <link th:href="@{/css/docs.css}" rel="stylesheet">
    <link th:href="@{/css/toolkit-light.css}" rel="stylesheet">
    <link th:href="@{/css/test.css}" rel="stylesheet">

    <style>
        .margin_top {
            margin-top: 12px;
        }

        .logo {
            width: 8%;
            height: auto;
        }

        .nav_top {
            margin-top: 5px;
            right: 1.5%;
        }

        a:link, a:visited, a:hover, a:active {
            text-decoration:none;
        }

        .bigIcon {
            font-size: 72px;
        }

        .result_1 {
            text-align: center;
            width: 72%;
            margin: 0 auto;
        }

        .result_2 {
            margin: 0 auto;
            max-width: 560px;
            padding: 24px 0 8px;
        }

        .result_1 .title {
            font-size: 24px;
            color: rgba(0, 0, 0, .85);
            font-weight: 500;
            line-height: 32px;
            margin-bottom: 16px;
        }
    </style>
    <script type="text/javascript">
        $(document).ready(function () {
            var newDate = new Date(new Date().valueOf() + 120 * 60 * 1000);
            $("#time").countdown(newDate, function (event) {
                $(this).text(event.strftime('%H:%M:%S'));
            }).on('finish.countdown', function () {
                $("#submit").click();
                console.log("倒计时结束");
            });
        })
    </script>
</head>
<body>
    <div class="m-l-md m-r-md">
        <!--导航栏-->
        <div class="text-md-left margin_top">
            <div class="row">
                <img class="logo col-md-1" th:src="@{/img/ahza-black-oj.png}">
                <ul class="nav nav-bordered col-md-10 nav_top">
                    <li class="nav-header form-inline">
                        <h1>前台</h1>
                    </li>
                    <li class="margin_top">
                        <a href="/main">首页</a>
                    </li>
                    <li class="active margin_top"><a href="/myQuiz">我的考试</a></li>
                    <li class="margin_top"><a href="/logout">退出系统</a></li>
                </ul>
            </div>
        </div>
        <!--分割线-->
        <div class="row">
            <div class="ant-divider ant-divider-horizontal col-md-12">
                <h3 class="hr-divider-content hr-divider-heading"></h3>
            </div>
        </div>

        <div class="dashhead">
            <div class="dashhead-titles">
                <h3 class="dashhead-title">当前考试</h3>
                <h6 class="dashhead-subtitle">考试名称:<span th:text="${quiz_title}"></span></h6>
                <h6 class="dashhead-subtitle">考试类型:<span th:text="${quiz_type}"></span></h6>
                <h6 class="dashhead-subtitle">试卷名称:<span th:text="${paper_name}"></span></h6>
                <h6 class="dashhead-subtitle">试卷描述:<span th:text="${paper_description}"></span></h6>
            </div>
        </div>

        <div class="hr-divider">
            <h2 class="hr-divider-content hr-divider-heading">
                考试内容
            </h2>
        </div>
        <div class="docs-example">
            <form action="/judge" method="post">
                <input type="hidden" name="questionSize" th:value="${#lists.size(questions)}">
                <input type="hidden" name="quizId" th:value="${quizId}">
                <div th:each="question, questionStat:${questions}">
                    <!--回答错误-->
                    <div th:if="${not question__${questionStat.index}__false}">
                        <div class="row">
                            <div class="ant-col-md-24 form-group">
                                <div th:text="${question.title}"></div>
                            </div>
                        </div>
                        <div th:each="choice, choiceStat:${question__${questionStat.index}__choices}">
                            <div class="ant-col-md-23 form-group">
                                <input type="text" class="form-control has-error" style="border-color: red" th:value="${choice.content}" disabled>
                            </div>
                            <div class="ant-col-md-23 form-group">
                                <input type="text" class="form-control" th:value="${choice.illustration}" disabled>
                            </div>
                        </div>
                    </div>

                    <!--回答正确-->
                    <div th:if="${question__${questionStat.index}__false}">
                        <div class="row">
                            <div class="ant-col-md-24 form-group">
                                <div th:text="${question.title}"></div>
                            </div>
                        </div>
                        <div th:each="choice, choiceStat:${question__${questionStat.index}__choices}">
                            <div class="ant-col-md-23 form-group">
                                <input type="text" class="form-control has-success" style="border-color: green" th:value="${choice.content}" disabled>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>

        <div th:if="${passRate} gt 0.6" class="row result_1 result_2">
            <div class="ant-notification-notice-icon-success bigIcon">
                <i class="anticon anticon-check-circle ant-confirm-success"></i>
            </div>
            <div th:text="|通过率：${passRatePercent}|" class="title"></div>
        </div>
        <div th:if="${passRate} lt 0.6" class="row result_1 result_2">
            <div class="ant-notification-notice-icon-error bigIcon">
                <i class="anticon anticon-close-circle ant-confirm-error"></i>
            </div>
            <div th:text="|通过率：${passRatePercent}|" class="title"></div>
        </div>
    </div>
</body>
</html>